<?php
abstract class Controller {
	abstract public function execute();

	private $query = array();

	public static function newInstance($q) {
		if(!is_array($q))
			$q = explode(' ', $q);
		$v = 'Controller'.ucfirst(array_shift($q));
		return new $v($q);
	}
	
	protected function __construct($q) {
		$this->setQuery($q);
	} 

	protected function getQuery() {
		return array_shift($this->query);
	}
	
	protected function getQueryRaw() {
		return $this->query;
	}

	protected function addQuery($q) {
		array_unshift($this->query, $q);
		return $this;
	}
	
	protected function setQuery(Array $t) {
		$this->query = $t;
		return $this;
	}
}